package com.ycsj.goldmedalnewconcept.parent.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.makeramen.roundedimageview.RoundedImageView;
import com.ycsj.common.utils.DateUtils;
import com.ycsj.common.view.StarBar;
import com.ycsj.goldmedalnewconcept.R;
import com.ycsj.goldmedalnewconcept.parent.bean.EvaluateInfo;

import java.util.List;

/**
 * 评价老师列表适配器
 * Created by Administrator on 2018/6/20 0020.
 */

public class EvaluateRvAdapter extends BaseQuickAdapter<EvaluateInfo.ListBean, BaseViewHolder> {
    private Context context;


    public EvaluateRvAdapter(Context context, int layoutResId, @Nullable List<EvaluateInfo.ListBean> data) {
        super(layoutResId, data);
        this.context = context;
    }


    @Override
    protected void convert(BaseViewHolder helper, EvaluateInfo.ListBean item) {
        //头像
        RoundedImageView headImg = helper.getView(R.id.iv_head);
        //全部显示默认头像
        headImg.setImageResource(R.drawable.head_default);

        //电话
        TextView tvTel = helper.getView(R.id.tv_tel);
        tvTel.setText(item.TEACHER_MOBILE);

        //时间
        TextView tvTime = helper.getView(R.id.tv_time);
        tvTime.setText(DateUtils.getTime(item.UPDATE_DATE, "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd"));

        //星级控件
        StarBar bar = helper.getView(R.id.bar);
        bar.setEnabled(false);

        //家长评语
        TextView tvContent = helper.getView(R.id.tv_content);
        tvContent.setText(item.CONTENT);

        //设置等级
        bar.setStarMark(item.SCORE);

        //设置电话
        tvTel.setText(item.USER_ID.substring(0, 3) + "*****" + item.USER_ID.substring(8, 11));

    }
}
